<template>
	<view class="content" >

		<view v-if="show_main" class="main" >
			<view class="pt80 bgf pr" style="text-align: center;height: 640rpx;">
				<image src="/static/image/9104935.png" style="width: 434rpx;" mode="widthFix"></image>
				<view class="pa f32" style="width:100%;top:230rpx;left:0;text-align: center;">
					<view>已签到天数</view>
					<view class="b f40 mt30" style="color:#4874cb">{{result.series_num}}天</view>
				</view>
				<view class="mt10 f32">今天签到可获得<text class="f50" style="color:red;">{{result.current_sin}}</text>{{result.virtual_coin_name}}</view>
			</view>
			<view class="pr" style="min-height: 300rpx;background: #f4f4f4;top:-130rpx;border-top-right-radius: 50%;border-top-left-radius: 50%;">
				<view class="" style="text-align: center;padding-top: 120rpx;">
					
					<view :class="'mr50 '+(result['series_num'] < 1 ? 'disbaled-sign-list' : '')" style="display: inline-block;color:#4874cb">
						<view><u-icon name="dakaqiandao" custom-prefix="qxl-icon" size="100"></u-icon></view>
						<view class="f30">第1天</view>
					</view>
					
					<view :class="'mr50 '+(result['series_num'] < 2 ? 'disbaled-sign-list' : '')" style="display: inline-block;color:#4874cb">
						<view><u-icon name="dakaqiandao" custom-prefix="qxl-icon" size="100"></u-icon></view>
						<view class="f30">第2天</view>
					</view>
					
					<view :class="result['series_num'] < 3 ? 'disbaled-sign-list' : ''" style="display: inline-block;color:#4874cb">
						<view><u-icon name="dakaqiandao" custom-prefix="qxl-icon" size="100"></u-icon></view>
						<view class="f30">第3天</view>
					</view>
					
				</view>

				<view class="pa" style="text-align: center;width: 100%;left:0;bottom: -300rpx;">
					<view @click="sign" :class="result.is_signed_today ? 'disabled-sign' : ''" style="width: 200rpx;height: 200rpx;border-radius: 50%;background: #4874cb;display: inline-block;line-height: 200rpx;">
						<text class="colfff">签到</text>
					</view>
				</view>
			</view>
		</view>
		
		<loading :loading="not_load"/><!--加载状态-->
	</view>
</template>

<script setup>
import { onLoad, onShow, onHide, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app';
import { ref } from 'vue';	
const show_main=ref(true);
const page_load=ref(false);
const not_load=ref(false);
const result=ref({});
//页面加载时
onLoad(async (options)=>{
    loadPage(options,false);
});
//页面显示时执行
onShow(()=>{
	//console.log('语法糖onShow');
});
//页面隐藏时执行
onHide(()=>{
	//console.log('语法糖onHide');
});
/**
 * 加载接口数据
 * @param {Object} options  参数,对像数组
 * @param {Object} isPage   是否加载大于1页
 */
const loadPage=async (options,isPage)=>{
	let ret = await uni.$get('/appapi-sign-getstatus',options);
	console.log(ret);
	if(ret.error_code != 0){
		uni.$utils.showToast(ret.info);
		return;
	}
	show_main.value=true;
	not_load.value=true;
	result.value=ret.data;
};
/**
 * 模板属性跳转页面
 * @param {Object} e
 */
function goPage(event){
	topDropDownShow.value=false;
	uni.$utils.dataSetPage(event);
};
// 签到
const sign=async()=>{
	if(result.value.is_signed_today || !not_load.value) return;
	not_load.value=false;
	let ret = await uni.$get('/appapi-sign-arrive',{});
	//console.log(ret);
	not_load.value=true;
	if(ret.error_code != 0){
		uni.$utils.showToast(ret.info);
		return;
	}
	uni.$utils.showToast('签到成功',0,()=>{
		loadPage({},false);
	});
};
</script>

<style  lang="scss">
	page {
		
	}
	.disabled-sign{
		background: #cccccc !important;
		color: #eeeeee !important;
	}
	.disabled-sign text{
		color: #eeeeee !important;
	}
	.disbaled-sign-list{
		color:#999999 !important;
	}
</style>
